﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace Dasaar.Interaction.TellStick
{

    public sealed class TellStickManager
    {

        private List<Device> allDevices;

        public TellStickManager()
        {
            allDevices = new List<Device>();
            TelldusCore.InitDLL();         
            
            int devicesToLoad = TelldusCore.GetNumberOfDevices();
            for (int i = 0; i < devicesToLoad; i++)
            {
                Device newDevice = new Device(TelldusCore.GetDeviceID(i));
                allDevices.Add(newDevice);
            }
        }

        ~TellStickManager()
        {
            TelldusCore.CloseDLL();
        }

        public List<Device> Devices
        {
            get { return allDevices; }
        }

    }

}

